<?php
/**
 * FrontPress - PHP in plain English
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @license http://www.gnu.org/licenses/gpl.html GNU GPL, version 3 or later
 * @package FrontPress
 * @subpackage Loader
 */

/**
 * The absolute path to the installation of FrontPress
 */
define( 'FRONTPRESS_PATH', dirname( __FILE__ ) . '/' );
/**
 * The absolute path to the included BackPress
 */
define( 'BACKPRESS_PATH', FRONTPRESS_PATH . 'backpress/' );

/**
 * Name of the site
 */
if ( !defined( 'FRONTPRESS_SITE_NAME' ) )
	define( 'FRONTPRESS_SITE_NAME', 'My Awesome FrontPress Site' );

/**#@+
 * BackPress core
 */
require_once BACKPRESS_PATH . 'functions.core.php';
require_once BACKPRESS_PATH . 'functions.compat.php';
require_once BACKPRESS_PATH . 'functions.formatting.php';
require_once BACKPRESS_PATH . 'functions.plugin-api.php';
require_once BACKPRESS_PATH . 'functions.bp-options.php';
require_once BACKPRESS_PATH . 'class.wp-error.php';
/**#@-*/

/**#@+
 * BackPress data storage
 */
require_once BACKPRESS_PATH . 'class.bpdb-multi.php';
if ( defined( 'FRONTPRESS_CACHE_TYPE' ) && file_exists( BACKPRESS_PATH . 'loader.wp-object-cache-' . FRONTPRESS_CACHE_TYPE . '.php' ) ) {
	require_once BACKPRESS_PATH . 'loader.wp-object-cache-' . FRONTPRESS_CACHE_TYPE . '.php';
} else {
	require_once BACKPRESS_PATH . 'loader.wp-object-cache.php';
}
wp_cache_init();
/**#@-*/

/**#@+
 * BackPress data sanitization
 */
require_once BACKPRESS_PATH . 'functions.kses.php';
/**#@-*/

/**#@+
 * BackPress script and style loaders
 */
require_once BACKPRESS_PATH . 'class.wp-dependencies.php';
require_once BACKPRESS_PATH . 'class.wp-scripts.php';
require_once BACKPRESS_PATH . 'class.wp-styles.php';
require_once BACKPRESS_PATH . 'functions.wp-scripts.php';
require_once BACKPRESS_PATH . 'functions.wp-styles.php';
/**#@-*/

/**#@+
 * FrontPress core
 */
require_once FRONTPRESS_PATH . 'functions.core.php';
/**#@-*/

/**#@+
 * FrontPress thing
 */
require_once FRONTPRESS_PATH . 'interface.fp-thing.php';
require_once FRONTPRESS_PATH . 'class.fp-validation-rules.php';
require_once FRONTPRESS_PATH . 'class.fp-thing.php';
require_once FRONTPRESS_PATH . 'class.fp-things.php';
/**#@-*/

/**#@+
 * FrontPress i18n
 */
if ( !defined( 'FRONTPRESS_LOCALE' ) )
	define( 'FRONTPRESS_LOCALE', '' );
require_once BACKPRESS_PATH . 'pomo/mo.php';
require_once FRONTPRESS_PATH . 'functions.i18n.php';
/**#@-*/

/**#@+
 * FrontPress router
 */
require_once FRONTPRESS_PATH . 'functions.template.php';
require_once FRONTPRESS_PATH . 'class.fp-route.php';
require_once FRONTPRESS_PATH . 'class.fp-router.php';
require_once FRONTPRESS_PATH . 'class.fp-notice.php';
/**#@-*/

/**#@+
 * FrontPress user
 */
if ( !defined( 'WP_AUTH_COOKIE_VERSION' ) )
	define( 'WP_AUTH_COOKIE_VERSION', 2 );
require_once BACKPRESS_PATH . 'class.bp-roles.php';
require_once BACKPRESS_PATH . 'class.bp-user.php';
require_once BACKPRESS_PATH . 'class.wp-pass.php';
require_once BACKPRESS_PATH . 'class.wp-users.php';
require_once BACKPRESS_PATH . 'class.wp-auth.php';
require_once FRONTPRESS_PATH . 'class.fp-user.php';

/**
 * @var BP_Roles
 */
$wp_roles = new BP_Roles();
/**#@-*/

/**@#+
 * FrontPress install
 */
require_once BACKPRESS_PATH . 'class.bp-sql-schema-parser.php';
require_once FRONTPRESS_PATH . 'class.fp-installer.php';
/**#@-*/
